<%@ page import="rcfirewall.conexaoBD,java.sql.*,javax.sql.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Softpar Firewall</title>
</head>
<body>

<form method="post" action="executeRule.jsp">
<select name="direction">
<%

//Here we will search the database to create the dropdown menu dinamically
//These will be the options displayed to the user create a new rule. 
//The option are: Direction, Destination, Source, Hosts, Port Numbers and Action
//After that we forward the options to the executeRule.jsp so we can create the iptables command based on them.

conexaoBD bd = new conexaoBD();
String dbtime;
ResultSet rs = bd.montaDropDown2("select * from DIRECTION ORDER by descricao");
while (rs.next()) {
%>;	
    <option value="<%= rs.getString(2) %>"><%= rs.getString(2) %> </option>
<%
} 
%>
</select>


<select name="source">
<%
rs = bd.montaDropDown2("select * from DESTINATION order by name");
while (rs.next()) { %>	
    <option value="<%= rs.getString(1) %>"><%= rs.getString(1) %> </option>
<%
} 
%>
</select>

<select name="destiny">
<%
rs = bd.montaDropDown2("select * from DESTINATION order by name");
while (rs.next()) { %>	
    <option value="<%= rs.getString(1) %>"><%= rs.getString(1) %> </option>
<%
} 
%>
</select>

<select name="srcPort">
<%
rs = bd.montaDropDown2("select * from PORT_NUMBER order by service_name");
while (rs.next()) { %>	
    <option value="<%= rs.getString(2) %>"><%= rs.getString(2) %> </option>
<%
} 
%>
</select>

<select name="dstPort">
<%
rs = bd.montaDropDown2("select * from PORT_NUMBER order by service_name");
while (rs.next()) { %>	
    <option value="<%= rs.getString(2) %>"><%= rs.getString(2) %> </option>
<%
} 
%>
</select>

<select name="protocol">
<%
rs = bd.montaDropDown2("select * from PROTOCOL order by protocol_name");
while (rs.next()) { %>	
    <option value="<%= rs.getString(1) %>"><%= rs.getString(1) %> </option>
<%
} 
%>
</select>

<select name="action">
<%
rs = bd.montaDropDown2("select * from TARGET order by descricao");
while (rs.next()) { %>	
    <option value="<%= rs.getString(2) %>"><%= rs.getString(2) %> </option>
<%
} 
%>
</select>
<br></br>
Comentário: <input type="text" name="comment" />

<input type="Submit" value="Criar Regra">
</form>
<br></br>
<br></br>

<FORM NAME="fullAccess" ACTION="fullAccess.jsp" METHOD="POST">
            <INPUT TYPE="SUBMIT" VALUE="Acesso Full">
 </FORM>            
<br></br>

<br>





</body>
</html>